package tech.yangzhijie.basic.thread;

public class FibonacciRunnable implements Runnable {

    private int n;

    public FibonacciRunnable() {
    }

    public FibonacciRunnable(int n) {
        this.n = n;
    }

    public int f(int x){
        return x > 2?f(x-1)+f(x-2):1;
    }

    @Override
    public void run() {
        for(int i=1;i<=n;i++)
            System.out.println(Thread.currentThread().getName()+"  "+f(i));
    }
}
